package AccionBoton;

import javax.swing.JTextField;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;

import paginas.PaginaAspectoBoton;
import plantilla.BotonTO;

public class AccionCambiarTextoBoton implements DocumentListener{
	
	private PaginaAspectoBoton _frame;
	private JTextField _texto;
	
	
	public AccionCambiarTextoBoton(PaginaAspectoBoton frame, JTextField texto){
		
	_frame = frame;
	_texto = texto;
		
	}
	
	public void changedUpdate(DocumentEvent e){
		

		
	}
	
	public void insertUpdate(DocumentEvent e){
		
		BotonTO b = _frame.get_botonTO();
		b.setTextoBoton(_texto.getText());
		_frame.get_boton().getLabelTexto().setText(_texto.getText());
		_frame.pack();
		_frame.repaint();
	}

	public void removeUpdate(DocumentEvent e){
		
		BotonTO b = _frame.get_botonTO();
		b.setTextoBoton(_texto.getText());

		_frame.get_boton().getLabelTexto().setText(_texto.getText());

		_frame.pack();
		_frame.repaint();
	}
}
